package com.example.zlw.dem20;

import com.example.zlw.dem18.PigFarm;

/**
 * @program: Zlw
 * @description:
 * @author: 诸葛龙辰
 * @create: 2022-11-08 20:20
 **/
public class Test {
    public static void main(String[] args) {
 Pig pig = new Pig();
 PigAdapter pigAdapter = new PigAdapter(pig);
        System.out.println("豬溫："+pigAdapter.pig30()+"度");
    }
}
class  PigAdapter implements Pig30{
    private Pig pig;
    public PigAdapter(Pig pig) {
        this.pig = pig;
    }
    @Override
    public int pig30(){
        int temp = pig.Pig();
        return (temp +29);
    }
}




class Pig {
    public int Pig() {
        int temp = 1;
        return temp;
    }
}

interface Pig30{
    int pig30();
}